﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Mobile.Models.ProductListModels>" %>
<%@ Import Namespace = "SDT.Lib.Paging" %>
<%@ Import Namespace = "SDT.Lib.Helpers" %>
<%@ Import Namespace = "SDT.Model" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Tìm Kiếm
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><div id="top"></div>
<div class="mar_top">
    <form action="/Product/Index/" method="post">
        <input type="text" name="productname" />
        <%=Html.DropDownList("ddlProductType", new SelectList(Model.ProductTypes, "ID", "Name"), "-- Chọn Danh mục -- ", new { })%>
        <label>&nbsp;</label><input type="submit" value="" class="btn" />
    </form>
</div>
<div class="tit_bg"><span class="pad"></span> &nbsp;</div>
    <br />
    <div class="clear"></div>
    <div class="line_dot"></div>
    <div class="sr_list">
      <form action="/Product/timkiem/">
        <table>
            <tr>
                <td><strong>Đăng tin bán/ Cho thuê</strong>&nbsp;</td>
                <td><%=Html.DropDownList("ddProductType", new SelectList(Model.ProductTypes, "ID", "Name"), "-- Chọn Danh mục -- ", new { style = "width:150px" })%></td>
            </tr>
            <tr>
                <td><strong>Loại Nhà Đất</strong>&nbsp;</td>
                <td><select id="ddlCat" name="ddlCat" style="width:150px" >
                        <option>--Chọn Loại Nhà Đất --</option>
                    </select>
                 </td>
            </tr>
            <tr>
                <td><strong>Tỉnh/Thành phố</strong> &nbsp;</td>
                <td><%=Html.DropDownList("ddlCity", new SelectList(Model.Cities, "ID", "Name"), "-- Tỉnh/Thành Phố -- ", new { style = "width:150px" })%></td>
            </tr>
            <tr>
                <td><strong>Quận/Huyện</strong> &nbsp; </td>
                <td><select id="ddlDistrict" name="ddlDistrict" style="width:150px">
                        <option>--Chọn Quận/ Huyện --</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><strong>Diện Tích</strong>&nbsp;</td>
                <td><select id="ddlArea" name="ddlArea" style="width:150px">
                        <option>--Chọn Diện Tích --</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><strong>Giá</strong>&nbsp;</td>
                <td><select id="ddlPrice" name="ddlPrice" style="width:150px" >
                        <option>--Chọn Mức Giá --</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><strong>Dự án</strong>&nbsp;</td>
                <td><select id="ddlProject" name="ddlProject" style="width:150px" >
                        <option>--Chọn Dự Án --</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label>&nbsp;</label></td>
                <td> <label>&nbsp;</label><input type="submit" value="" class="btn" /></td>
            </tr>
        </table>
    </form>
   </div>    
 <div class="clear"></div>
 <div class="line_dot"></div>
   <br />
   <div class="t_sm">site map</div>
   <div><a href="/Home/index" class="l_blue">Trang chủ</a></div>
       <div class="list_st">
           <ul>
            <% foreach (var item1 in Model.ProductTypes)
               { %>
                    <li><a href="/Product/Index/<%=item1.ID %>"><%= item1.Name%></a></li>
              <% } %>
               <% foreach (var item2 in Model.ArticleCategorys)
                  { %>
                    <li><a href="/Article/Index/<%=item2.ID %>"><%= item2.Name%></a></li>
              <% } %>
           </ul>
      </div>
    <div class="f_r"><a href="#top" class="l_gr">Lên đầu trang</a></div>
    <div class="clear"></div>  
<script type="text/javascript">
    $(document).ready(function() {
      $('#ddProductType').change(function() {
      var id = $('#ddProductType').val() == "" ? 0 : $('#ddProductType').val();
            $.get('/AjaxData/GetProductCategoryByType/' + id, function(data) {
                $('#ddlCat').html(data);
            });
        });
        $('#ddlCity').change(function() {
            var id = $('#ddlCity').val() == "" ? 0 : $('#ddlCity').val();
             $.get('/AjaxData/GetDistrict/' + id, function(data) {
                $('#ddlDistrict').html(data);
            });
        });
        $('#ddProductType').change(function() {
            var id = $('#ddProductType').val() == "" ? 0 : $('#ddProductType').val();
            $.get('/AjaxData/GetPrice/' + id, function(data) {
            $('#ddlPrice').html(data);
            });
        });
        $('#ddProductType').change(function() {
            var id = $('#ddProductType').val() == "" ? 0 : $('#ddProductType').val();
            $.get('/AjaxData/GetArea/' + id, function(data) {
            $('#ddlArea').html(data);
            });
        });
        $('#ddlDistrict').change(function() {
        var id = $('#ddlDistrict').val() == "" ? 0 : $('#ddlDistrict').val();
        $.get('/AjaxData/GetProjectByDistrict/' + id, function(data) {
            $('#ddlProject').html(data);
            });
        });
    });
</script>
</asp:Content>
